using Godot;
using System;

public partial class ChildTask : MarginContainer
{
	public Button taskbutton;
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		taskbutton = GetNode<Button>("%Button");
	}
	public void Initialize()
	{
		var Game = GetNode<Game>("/root/Game");
		MessageManager messageManager = Game.get_message_manager();
		taskbutton = GetNode<Button>("%Button");
		var parentname = (this.GetParent().Owner as TaskBar).taskbutton.Text;
		taskbutton.ButtonUp += () => messageManager.EmitSignal("ChooseTask",taskbutton.Text,parentname);
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}
	public void SetTaskName(string taskName)
	{

		taskbutton.Text = taskName;
		this.LayoutDirection = Godot.Control.LayoutDirectionEnum.Rtl;
	}
}
